package com.fh.service.generalview.impl;

import com.alibaba.fastjson.JSON;
import com.fh.mapper.loan.CallLoanInfoMapper;
import com.fh.model.Page;
import com.fh.service.generalview.IGeneralViewService;
import com.fh.util.Const;
import com.fh.util.PageData;
import com.fh.util.R;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * @Author LiGuangYi Date: 2017/9/21 9:51
 * @description: 催收查询模块
 */
@Service
public class GeneralViewServiceImpl implements IGeneralViewService {

    @Autowired
    private CallLoanInfoMapper callLoanInfoMapper;

    /**
     * 催收查询页面数据
     *
     * @param page
     * @return
     */
    @Override
    public List<PageData> findGeneralViewlistPage(Page page) {
        PageData.trimPage(page);
        PageData pd = page.getPd();
        if (0 < pd.size()) {
            String statusType = pd.get("statusType")==null?null:pd.get("statusType").toString();
            if (null != statusType && !"".equals(statusType)) {
                if ("0".equals(statusType)) {
                    page.getPd().put("statusTypesNo", "1");
                }
                if ("1".equals(statusType)) {
                    page.getPd().put("statusTypesYes", "2");
                }
            }
        }
        R.setPageHelper(pd);
        List<PageData> generalViewlistPage = callLoanInfoMapper.findGeneralViewListPage(page);
        R.setPage(page,generalViewlistPage);
        return generalViewlistPage;
    }

}
